Relative Probabilities 1

Let's suppose we have a fair coin and we flipped it four times. I'd like you to tell me what is the probability that there is exactly one head divided by the probability that only the very first flip is a head.

Answer

  • The correct answer is 4.
  • To see this, note that for the first flip to be only a head, the following is the only sequence possible.
H T T T
T H T T
T T H T
T T T H

heads = 0.5 tails = 0.5

(0.5 * 0.5 * 0.5 * 0.5) * 4 / (0.5 * 0.5 * 0.5 * 0.5) = 4

Screenshot taken from Udacity

Relative Probabilities 2

Now, I'd like to tell me the ratio of the probability of exactly one head to the probability of the first flip being heads regardless of the other flips.

Answer

  • And the answer is 0.5 or 1/2.
  • To see this, recall that there were four possibilities for the numerator--all equally likely, and if the first flip is heads and we have no other restrictions, the last three flips can be anything.
  • So each one has two possibilities and 2*2*2=8 and 4/8=0.5

Screenshot taken from Udacity

Same Coin

  • Let's assume there are two coins equally distributed, same probability of having each.
  • The first type of coins are fair. The second type of coins have a probability of heads of 0.9--90%. Let's assume you and I both flip a coin. When I flipped, I get the following sequence: HHT
  • When you flipped, you get the following sequence: THH
  • So please write in this box the probability that we flipped coins of the same type.

Answer

Problem's given:

Probability we randomly choose the fair coin (coin 1): P(1)=0.5

Probability we randomly choose the loaded coin (coin 2): P(2)=0.5

Probability that the coin shows heads GIVEN that it's the fair coin (coin 1): P(H|1)=0.5

Probability that the coin shows heads GIVEN that it's the loaded coin (coin 2): P(H|2)=0.9

My flips: HHT

Your flips: THH

Problem's aim:

The problem asks for the probability that both coins flipped were of the same kind.

Someone could argue: "Well that's easy. It's the probability of both people randomly selecting the fair coin (coin 1) plus the probability of both of them randomly selecting the loaded coin (coin 2). That is: $%P(1 \cap 1) + P(2 \cap 2)=P(1) \cdot P(1)+P(2) \cdot P(2)=0.5 \cdot 0.5+0.5 \cdot 0.5=0.5$%, since $%P(1 \cap 1)=P(1) \cdot P(1)$% is the joint probability of two independent events, the first person selecting coin 1 and the second person also selecting coin 1. This looks logical; half of the time the two persons select the same coin". The truth table verifies this:

-----1st person --------------------------- 2ndperson-------

coin1 coin1 coin1 coin2 coin2 coin1 coin2 coin2 But, wait. There is a catch: the flips were not taken into account!

Reading more carefully the problem asks for the probability that both coins flipped were of the same kind, GIVEN the flips observed, i.e. $%P(1|HHT)$% and $%P(2|HHT)$%

Note: The sequence of the flips does not change the probability of the flips, i.e. both flips are of equal probability.

Solution:

Given that we selected a fair coin (coin1), the probability for the flips is $$P(HHT|1)=0.5\cdot 0.5\cdot 0.5=0.125$$ Hence the probability $$P(HHT \cap 1)=P(HHT|1) \cdot P(1)=0.125 \cdot 0.5=0.0625$$

Likewise, given that we selected the loaded coin (coin2), the probability for the flips is $$P(HHT|2)=0.9\cdot 0.9\cdot (1-0.9)=0.081$$

$$P(HHT \cap 2)=P(HHT|2) \cdot P(2)=0.081 \cdot 0.5=0.0405$$

Thus $$P(HHT)=P(HHT \cap 1)+P(HHT \cap 2)=0.0625+0.0405=0.103$$

So $$P(1|HHT)= \large \frac {P(HHT \cap 1)} {P(HHT)} \normalsize = \frac {0.0625}{0.103} =0.606796117$$

and $$P(2|HHT)= \large \frac {P(HHT \cap 2)} {P(HHT)} \normalsize = \frac {0.0405}{0.103} =0.393203883$$

Finally, the probability of both persons selecting the same kind of coins is $$P(1|HHT) \cdot P(1|HHT)+P(2|HHT) \cdot P(2|HHT)=0.606796117^2+0.393203883^2=0.522810821$$

Screenshot taken from Udacity

Many Flips

Now, I'd like to ask you about what happens as the number of flips or events, in general, becomes a very large number. Check all that apply.

  • The probability of every individual sequence becomes small
  • The probability of every number of heads becomes small. So for example, does the probability of having one head or hundred heads or million heads, any specific number does that becomes small.
  • Does the probability of every given proportion, for example, one head out of 100 flips, 10 heads out of 100 flips or 1500 heads out of a billion flips becomes small.
  • Does every given range of proportions have a smaller and smaller probability.
  • Are there some ranges of proportions for which the probability becomes small as we have many flips.
  • Check all that apply. Also, assume that the probability of heads is neither 0 or 1. That is, we can get both heads and tails from this coin.

# flips # cases Pr. per case possible cases 2 2^2 = 4 1/4 = 0.25 HH, HT, TH, TT 3 2^3 = 8 1/8 = 0.125 HHH, HHT, HTH, HTT, THH, THT, TTH, TTT 4 2^4 = 16 1/16 = 0.0625 HHHH, HHHT, HHTH, HHTT, HTHH, HTHT, ... 1 - The probability of every sequence becomes small.

The probability of any one sequence is

$$P(\mbox{any one sequence}) = \frac{1}{\mbox{num permutations}} = \frac{1}{2^{\mbox{flips}} }$$

so more flips, smaller probability

2 - The probability of every number of heads becomes small.

This could mean 2 things. One, the total number of heads:

P(2 heads) for 2 flips = P(HH) = 1/4 = 0.25 P(2 heads) for 3 flips = P(HHT)+P(HTH)+P(THH) = 1/8 * 3 = 3/8 = 0.375 P(2 heads) for 4 flips = P(HHTT)+P(HTHT)+P(HTTH)+ P(THTH)+P(THHT)+P(TTHH) = 1/16 * 6 = 0.375 P(2 heads) for 5 flips = 10 * 1/32 = 0.3125 which gets smaller with the number of flips or, two, the number of heads in a sequence, like exactly 2 heads followed by tails, in which case we have:

P(2 heads plus tails) for 2 flips = P(HH) = 1/4 P(2 heads plus tails) for 3 flips = P(HHT) = 1/8 P(2 heads plus tails) for 4 flips = P(HHTT) = 1/16 which also gets smaller with the number of flips

3 - The probability of every proportion of heads becomes small.

For example, I want half the flips (i.e., a proportion) to be heads

P(1/2 of 2 flips are heads) = P(HT) + P(TH) = 1/4 + 1/4 = 1/2 P(1/2 of 4 flips are heads) = P(HHTT) + P(HTHT) + P(THTH) + P(THHT)+ P(TTHH) + P(HTTH) = 6*(1/2^4) = 3/8 4- The probability of every range of proportions becomes small. ok.. there were several comments about my original explanation of points 4 and 5 being unclear and.. sure enough.. they were. I was not happy with the explanations either so I figured out a way to explain them in a different way without getting too much into combinatorics.

First let's figure out the basics. If I flip a coin n times I generate one of $%2^n$% sequences. How many of those possible sequences have k heads? One way to find the answer is to use Pascal's triangle, in which an entry in the triangle is the sum of the two entries immediately above it:

Image from mathisfun.com

The sum of the numbers in any of the rows of the triangle gives the powers of 2: 2, 4, 8, 16, 32, 64, 128.. etc. which correspond to the number of sequences generated by flipping a coin 1, 2, 3, 4, 5, 6, and 7 times, respectively. In other words, if you flip a coin n times, you have any of $%2^n$% sequences which is also the sum of the numbers of the n-th row of Pascal's triangle (when the row at the top is the 0-th row).

The entries in Pascal's triangle can be interpreted as the number of times that a coin will land in, say, heads. For example, if you flip a coin 4 times, you will get one of $%2^4 = 16$% possible sequences. Looking at the 4th row of Pascal's triangle (the one whose entries add up to 16) we have the following correspondance:

1 = # of sequences with 0 heads = TTTT 4 = # of sequences with 1 heads = TTTH, TTHT, THTT, HTTT 6 = # of sequences with 2 heads = TTHH, THTH, HTTH, THHT, HTHT, HHTT 4 = # of sequences with 3 heads = HHHT, HHTH, HTHH, HHHT 1 = # of sequences with 4 heads = HHHH Likewise, if we flip the coin 7 times we will have $%2^7 = 128$% cases and, looking at Pascal's triangle,

we find that 21 of these sequences have 2 heads, 35 of them have 3 heads, 6 of them have 7 heads, and so on.

Another way to find any of the entries of Pascal's triangle is using the binomial coefficient:

$$\binom{n}{k} = \frac{n!}{k!(n-k)!}$$

or $%C(n, k)$%, for short, where $%n!$% is the factorial of n, i.e.,

$$ n! = n(n-1)(n-2)\cdots 2\cdot 1 $$

So, for example, if we want to find how many of the $%2^7=128$% sequences generated with 7 flips have 2 heads we have

C(7,2) = 7! / (2! (7-2)!) = 7! / (2! 5!) = 5040 / (2 * 120) = 21 which agrees with the entry in Pascal's triangle.

Now back to the question. We are going to consider all of sequences that have less than 50% heads (i.e., the proportion is a given percentage( e.g., 25% heads) while the range of proportions is from 0 to 50%). We'll consider only the odd number of flips that gives us a nice boundary for the 50% bound.

Flips # sequences # seqs with [0-50)% heads P 1 2^1 = 2 1 (i.e., H) 1*(1/2) = 0.5 3 2^3 = 8 1+3 = 4 4*(1/8) = 0.5 5 2^5 = 32 1+5+10 = 16 16*(1/32) = 0.5 7 2^7 = 128 1+7+21+35 = 64 64*(1/128) = 0.5 etc. Thus, the probability of the sequences of having less than 50% heads does not get smallerr but instead is constant and, hence, point 4 is False.

5- The probablity of some ranges of proportions becomes small. Consider the probability of having sequences in which the proportion of heads is anywhere between 0 and 33%. Here we will use a larger Pascal's triangle that includes the entries for 9 and 12 flips:

from 43things.com

So now, we consider sequences of n flips where flips is a multiple of 3, which gives us a nice boundary for the 33%, i.e., a third of the flips or less have to be heads:

Flips # sequences # seqs with [0-33]% heads P 3 2^3 = 8 1+3 = 4 (TTT, HTT, THT, TTH) 4/8 = 0.5 6 2^6 = 64 1+6+15 = 22 22/64 = 0.343 9 2^9 = 512 1+9+36+84 = 130 130/512 = 0.254 12 2^12 = 4096 1+12+66+220+495 = 794 794/4096 = 0.1938 etc. where, for example, for 12 flips we have 1 flip with 0 heads, 12 with 1 head, 66 with 2 heads, 220 with 3 heads and 495 with 4 heads, i.e., up to 33% of the possible 12 flips.

A way to visualize this is the following. Look at the numbers that correspond to the 33%: 3 in the 3rd row, 15 in the 6th, 84 in the 9th and 495 in the 12th. Now, notice that all these numbers lie along a line that passes through the apex of the Pascal triangle. You could imagine continuing this line downwards, as you add more and more flips. For all these rows, all the entries to the left of this line correspond to sequences that have between 0 and 33% heads. However, notice that the values of these entries is progressively smaller with respect to those that accumulate in the middle of the rows. Thus, the larger the flip, the smaller the percentage of sequences that will have between 0-33% heads.

By the same token, the entries to the right of the line, which correspond fo the 33-100% heads case, have a number of heads that increases with the number of flips; this is expected as the 0-33% case is the complement of 33-100% case, i.e., if one becomes larger, the other one should become smaller.

You can 'swing' this line to the right, about the apex, until it is vertical. Now the triangle is split in equal parts and the entries on the left and right have the same values. Hence, at this point, the number of sequences that have 0-50% heads is exactly the same as those that have 50-100% heads. This was the case used in point 4 to show that not all range of proportions becomes smaller.

In summary, the probabiity of the sequences that have 33% or less heads (i.e., a range of proportions) grows smaller with the number of flips and point 5 is True

Screenshot taken from Udacity

Is it Fair 1

  • Let's assume we have a fair coin and a loaded coin and the loaded coin has a probability of heads of 0.9.
  • Let's assume that we know that the probability of actually having a loaded coin is zero.
  • In which of these cases is the probability of being fair given the flips <0.5. Check all that apply. Note that 4 H 0 T means four head and zero tails.

Answer

  • And in none of these cases is the probability of a fair coin given the data less than 0.5.
  • We know this simply because the probability of having a loaded coin at all is zero.
  • So if that doesn't make intuitive sense we can apply Bayes' Rule since P of loaded is zero P of fair is one and so P of flips given fair is always going to be equal to P of flips because that's the only way you can get the flips.
  • The alternative is zero and so this whole expression will always be one. You could also do this with the reverse in P of loaded and you'd see it would always come out to be zero because this term will be zero.

Screenshot taken from Udacity

Is it Fair 2

Now let me ask you if the probability of having a loaded coin is 0.1, what happens to the probability of fair given flips in each of these cases. Check all that have a probability of a fair coin of less than 0.5.

Answer